<?php
//--SEARCH FOR OLD AUTO
?>

<div class="grid_6">
    <div class="tabs tabs_var1">
        <ul class="nav">
            <li class="selected"><a href="#car_tab">Find Used Car</a></li>
        </ul>
        <div class="clear"></div>
        <div class="tabs_1">
            <div id="car_tab" class="tab-content">
                <div class="inner" style="height:292px">
                    <form id="form-main" method="post" action="<?= base_url(); ?>search/search_car/used">
                        <div class="rowElem">
                            <div class="block-underline">
                                <h2>Find a Used Car</h2>
                                
                                <label>Buy & sell used cars, know valuation, read tips & advice.</label>
                               </div>
                             <div style="color:red"><?php if ($this->session->flashdata('message')) { ?>
                                         <?= $this->session->flashdata('message'); ?>
                                    <?php } ?></div>
                            <div class="clear"></div>  
                            
                            <div class="fleft" style="width: 225px">
                               
                                <label><strong>Car Make:</strong></label>
                                <select name="car_make" style="width: 200px" onChange="getCarModel(this.value,'<?= base_url(); ?>');">
                                    <option value="" selected>Car Make</option>
                                    <?php foreach ($car_make as $car_make): ?> 
                                        <option value="<?= $car_make->id; ?>"><?= $car_make->make; ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>

                            <div class="fleft" style="width: 225px">
                                <label><strong>Model:</strong></label>
                                <div id="modeldiv">
                                    <select name="car_model" style="width: 200px" >
                                        <option value="" selected="" >Model</option>
                                    </select>
                                </div>    
                            </div>
                            <div class="clear"></div>        
                        </div>

                        <div class="rowElem">
                            <div class="fleft" style="width: 225px">
                                <label><strong>Country:</strong></label>
                                <select name="car_country" style="width: 200px" onChange="getState(this.value,'<?= base_url(); ?>');">
                                    <option value="" selected>Country</option>
                                    <option value="" disabled></option>
                                    <?php foreach ($car_country as $car_country): ?> 
                                        <option value="<?= $car_country->id; ?>"><?= $car_country->country; ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>

                            <div class="fleft" style="width: 225px">
                                <label><strong>State:</strong></label>
                                <div id="statediv">
                                    <select name="car_state" style="width: 200px" onChange="getCity(this.value,'<?= base_url(); ?>');">
                                        <option value="" selected>State</option>
                                    </select>
                                </div>
                            </div>
                            <div class="clear"></div>        
                        </div>

                        <div class="rowElem">
                            <div class="fleft" style="width: 225px">
                                <label><strong>City:</strong></label>
                                <div id="citydiv">
                                    <select name="car_city" style="width: 200px">
                                        <option value="" selected>City</option>
                                    </select>
                                </div>
                            </div>

                            <div class="fleft" style="width: 110px">
                                <label><strong>Min Year:</strong></label>
                                <select name="car_min_year" style="width: 90px" >
                                    <option value="" selected>Min</option>
                                    <?php foreach ($min_year as $min_year): ?> 
                                        <option value="<?= $min_year; ?>"><?= $min_year; ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="fleft" style="width: 100px">
                                <label><strong>Max Year:</strong></label>
                                <select name="car_max_year" style="width: 90px" >
                                    <option value="" selected>Max</option>
                                    <?php foreach ($max_year as $max_year): ?> 
                                        <option value="<?= $max_year; ?>"><?= $max_year; ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="clear"></div>        
                        </div>
                        <div class="rowElem">
                            <div class="fleft" style="width: 225px">
                                <label><strong>Budget (Max):</strong></label>
                                <input name="car_budget" type="text" style="width: 200px" ></input>
                            </div>

                            <div class="fleft mid_col">
                                <a onClick="document.getElementById('form-main').submit()" class="inline-block button_search color_1 bold"><span class="inline-block">Search Now !</span></a>
                            </div>
                        </div>

                    </form>



                </div>
            </div>

        </div>
    </div>
</div>